<?php
	include "common.php";
	error_reporting(0);
	session_start();	
	if($_SESSION['logInCheck']!=1){
		header('Location: index.php?loginInfo=false');
	}
	$systemDate=date('d-m-y');
	
	$blackBoxId = $_GET['carryName'];
	
	echo $sql = "UPDATE black_box_message SET status='0' WHERE id = '$blackBoxId'";
	$sqlQuery = mysql_query($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="notification.css" />
<link rel="stylesheet" type="text/css" href="show_report.css" />
<link rel="icon" type="image/ico" href="images/favicon.ico"></link> 
<link rel="shortcut icon" href="images/favicon.ico"></link>
<script src="home.js" type="text/javascript"></script>
<title>Black Box Message</title>
</head>

<body>
<div id="main_div">
	<div id="date_1">
    	<p class="home_date"><script>document.write(new_date);</script></p>
        <p class="home_date1">
			<script>document.write(new_month);</script><br />
            <script>document.write(new_day);</script><br />
        	<script>document.write(new_year);</script>
        <p>
        <p class="office_manager">OFFICE MANAGER</p>
        <div class="office_manager_underline"></div>
        <div class="logo_company"></div>
        
    </div><!-- end of date_1 -->

	<div class="icons_right">
    	<ul>
        	<a href="ceo.php"><li><img src="images/home_icon.png" /><p>Home</p></li></a>
            <a href="show_report.php"><li><img src="images/report_icon.png" /><p>Reports</p></li></a>
            <a href="apply_leave.php"><li><img src="images/apply_for_leave_icon.png" /><p>Apply for Leave</p></li></a>
            <a href="apply_meeting.php"><li><img src="images/apply_for_2mrmeeting_icon.png" /><p>Apply for Tommorow's Meeting</p></li></a>
        </ul>      
    </div><!-- end of icons_right-->
    
    <div class="user_information">
    	<p>Welcome <?php echo $userName?></p>
        <p style="color:#ca0000;"><?php echo "Employee Id :".$ID?></p>
        <p style="color:#990000"><?php echo "Supervisor : ".$supervisor?></p>
    </div><!-- end of user_information-->
    <div class="page_header">
    	<img src="images/blackbox.png" />
        <div class="page_header_underline"></div>
        <p>Check Black Box</p>
    </div><!-- end of page_header-->
    <div class="page_content">
    	<p class="header_page_content"></p>
        <table cellpadding="0" cellspacing="0">
        	<tr class="table_header_1"  valign="top" width="300px;">            	                
            	<td colspan="5">
                	<p>Black Box Message</p>
                </td>
            </tr>
			<tr valign="top" class="table_header_2">
				<td width="70px;;"><p>Date</p></td>
            	<td width="60px"><p>Sender</p></td>
                <td width="100px;"><p>Recipient</p></td>
                <td width="60px;"><p>Message</p></td>
            </tr>
			 <?php							
				$collectData = "SELECT * FROM black_box_message WHERE status=1";
				$collectDataQuery = mysql_query($collectData);
				while($collectDataFetchArray = mysql_fetch_array($collectDataQuery)){
					$collectDate = $collectDataFetchArray['Date'];
					$collectSender = $collectDataFetchArray['sender'];
					$collectRecipient = $collectDataFetchArray['to_whom'];
					$collectMessage = $collectDataFetchArray['message'];
					$collectId = $collectDataFetchArray['id'];
			?>
            <tr valign="top" class="table_header_3">
            	<td width="60px"><p><?php echo $collectDate; ?></p></td>
                <td width="100px;"><p><?php echo $collectSender; ?></p></td>
                <td width="60px;"><p><?php echo $collectRecipient; ?></p></td>
				<td width="60px;"><p><?php echo $collectMessage; ?></p></td>
                <td width="70px;"><p><a href="check_blackbox.php?carryName=<?php echo $collectId;?>">Delete</a></p></td>                          
            </tr>
            <?php } ?>
		</table>
		 
    </div><!-- end of page_content -->
	<a href="index.php"><div class="power"><img src="images/power_icon.png" /><p>Log-Off</p></div></a>
</div><!-- end of main_div-->
</body>
</html>
